<?php
 /**
  *  @package ARXLib
  *  @version 2
  *  @subpackage Inputs
  *
  *  @copyright Ringo-Web Inc. 2004 - 2005
  */
//////////////////////////////////////////////////////////////////////////////////////
// CARXImage
//////////////////////////////////////////////////////////////////////////////////////
    class CARXImage extends CARXInput
    {
        var $m_width;
        var $m_height;
        var $m_fileFolder;

        function CARXImage($label, $dbFieldName, $fileFolder, $width = NULL, $height = NULL)
        {
            parent::CARXInput($label, $dbFieldName);
            $this->m_width = $width;
            $this->m_height = $height;
            $this->m_fileFolder = $fileFolder;
        }

        function GetHTML()
        {
            $table = $this->GetDBTable();
         
            if (!$this->m_value)
            {
                $result = "<img src=\"" . ARX_LIB_URL . "/img/px.gif\" width=\"1\" height=\"1\" border=\"0\">";
            }
            else
            {
                if (is_int($this->m_width))
                {
                    $width = "width=" . $this->m_width;
                }
                else if ($this->m_width)
                {
                    $width = "width=\"" . $table->GetField($this->m_width) . "\"";
                }
                else
                {
                    $width = "";
                }

                if (is_int($this->m_height))
                {
                    $height = " height=" . $this->m_height;
                }
                else if ($this->m_height)
                {
                    $height = " height=\"" . $table->GetField($this->m_height) . "\"";
                }
                else
                {
                    $height = "";
                }

                $result = "<img src=\"$this->m_fileFolder/$this->m_value\"" . $width . $height . " alt=\"" . $this->m_label . "\" title=\"" . $this->m_label . "\" border=\"0\">\n";
            }
            return $result;
        }
        
        function GetHTMLSaved()
        {
            return $this->GetHTML();
        }
        
        function Submit()
        {
            // Do nothing to leave database field intact
        }
    }


?>